namespace Leey.Net.eTerm
{
    using System;
    using System.Text;

    public class LoginSteps
    {
        private byte[] sendb;

        internal byte[] iTermLoginStep2()
        {
            this.sendb = new byte[0x11];
            Command.StringToBytes("01 FE 00 11 14 10 00 02 00 00 00 00 00 00 00 00 00").CopyTo(this.sendb, 0);
            return this.sendb;
        }

        internal byte[] LoginStep1(string username, string password)
        {
            this.sendb = new byte[0xa2];
            this.sendb[0] = Convert.ToByte(1);
            this.sendb[1] = Convert.ToByte(0xa2);
            byte[] array = new byte[0x10];
            Encoding.ASCII.GetBytes(username).CopyTo(array, 0);
            array.CopyTo(this.sendb, 2);
            byte[] buffer2 = new byte[0x20];
            Encoding.ASCII.GetBytes(password).CopyTo(buffer2, 0);
            buffer2.CopyTo(this.sendb, 0x12);
            Command.StringToBytes("30 30 31 33 37 32 31 38 36 37 31 37 31 39 32 2E 31 36 38 2E 31 2E 32 30 30 20 20 33 33 32 31 33 31 30 00 30 30 30 30 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00").CopyTo(this.sendb, 50);
            return this.sendb;
        }

        internal byte[] LoginStep2()
        {
            this.sendb = new byte[260];
            Command.StringToBytes("01 F7 01 04 33 33 32 31 33 31 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00").CopyTo(this.sendb, 0);
            return this.sendb;
        }

        internal byte[] LoginStep2(byte[] a)
        {
            this.sendb = new byte[260];
            Command.StringToBytes("01 f7 01 04 33 33 32 31 33 31 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00").CopyTo(this.sendb, 0);
            a.CopyTo(this.sendb, 0x84);
            return this.sendb;
        }

        internal byte[] LoginStep3()
        {
            this.sendb = new byte[0x33];
            Command.StringToBytes("01 FE 00 11 14 10 00 02 00 00 00 00 00 00 00 00 00 01 FE 00 11 14 10 00 02 0C 00 00 00 00 00 00 00 00 01 FE 00 11 14 10 00 02 29 00 00 00 00 00 00 00 00").CopyTo(this.sendb, 0);
            return this.sendb;
        }
    }
}
